package com.itheima.health.controller;

import com.itheima.health.common.R;
import com.itheima.health.service.MemberService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
@Slf4j
@RestController
@RequestMapping("/member")
public class MemberConller {

    @Autowired
    private MemberService memberService;



    @PostMapping("/login")
    public R login(String telephone, String validateCode , HttpSession session) {
        return memberService.login(telephone,validateCode,session);

    }
    @ExceptionHandler(Exception.class)
    public R<String> handleException(Exception e) {
        log.error("请求处理发生异常", e);
        return R.error("请求处理发生异常");
    }
}
